package cn.bdqn.fin.controller;

import cn.bdqn.fin.model.Apply;
import cn.bdqn.fin.service.ApplyService;
import cn.bdqn.model.PageBean;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author gurilla
 * @create 2019-08-21 20:47
 */
@Controller
@RequestMapping("/fin/apply")
public class ApplyController {
    //调用
    @Resource
    private ApplyService applyService;

    @RequiresPermissions("fin:apply:page")
    @GetMapping
    public String topage(){
        return "/fin/apply";
    }

    @RequiresPermissions("fin:apply:list")
    @PostMapping("list")
    @ResponseBody
    public Object list(PageBean pageBean, String cname, String phone, String ptname, String drawee){
        return applyService.list(pageBean, cname,phone,ptname, drawee);
    }

    @RequiresPermissions("fin:apply:save")
    @PostMapping("save")
    @ResponseBody
    public Object save(Apply apply){
        return applyService.save(apply);
    }

    @GetMapping("getleader")
    @ResponseBody
    public Object getLeader(){
        return applyService.getLeader().getData();
    }

    @GetMapping("getPaymentType")
    @ResponseBody
    public Object getPaymentType(){
        return applyService.getPaymentType().getData();
    }

}
